/**
 * Created by Administrator on 2018/11/20.
 */
//查询数据
$CertusJsonAjax.ajax("signet/signetStepByProcId",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.signet = res.data.signet;
    //查询印章 select
    $CertusFormAjax.ajax("signet/signetEntityList", {location: $$scope.signet.locationCode}, function (res) {

        $$scope.signetCodeSelect = res.data;
    })
    $$scope.signetSubmit = {
        "processInstanceId": $CertusJsonAjax.getProInstanceId(),
        "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
    }
    $$scope.wkStepName = $CertusJsonAjax.getWkStepName();
    $$scope.processs = res.data.processs;
    $$scope.processCCBXTrace = res.data.processs;

})
//初始化 select
//使用方式 select
$$scope.usageModeSelect = [
    {
        name:"借出",code:"loan"
    },
    {
        name:"使用",code:"use"
    }
]

//查询印章 select
$CertusJsonAjax.ajax("signet/signetEntityList",null,function(res){
    $$scope.signetCodeSelect = res.data;
})

//下载文件
$$scope.yzlcDownload = function(){
    $CertusFormAjax.download("downloadFile", "fileId=" + $$scope.signet.fileId);
}

//同意 提交
$$scope.signetApproval = function(){
    $CertusJsonAjax.ajax("signet/stampExmine",$$scope.signetSubmit,function(res){
        if(res.data == "success"){
            findBacklogPerson($CertusFormAjax, $CertusJsonAjax.getStepInstanceId());
            history.back();
        }
    })
}

//领导 不同意 使用公章
$$scope.signetShut = function(){
    $CertusJsonAjax.ajax("signet/signetShut",$$scope.signetSubmit,function(res){
        if(res.data == "success"){
            layer.msg("用章使用流程已终结");
            history.back();
        }
    })
}

$$scope.getsssbbb = function(bb){
    if(bb == "starting"){
        return "正在进行中";
    }else if(bb == "denied"){
        return "否决";
    }else if(bb == "sentback"){
        return "被退";
    }else if(bb == "others"){
        return "关闭";
    }else if(bb == "completed"){
         return "完成";    }else if(bb == "terminated"){        return "终结";    }    else if(bb == "cancelled"){        return "通过";}
    return "待办";
}